﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Ditto.Models.FriendStatus>" %>
<div id="requeststatus">
<% if (Model.Type == Ditto.Models.FriendStatus.StatusType.None) { %>

<%: Html.ActionLink("Add", "RequestFriendship", new { requestedUser = Model.FriendID, message = "" })%> <%: Model.FriendID %> as a friend

<%} %>

<%else if (Model.Type == Ditto.Models.FriendStatus.StatusType.Requesting)
   { %>

You are now waiting for <%: Model.FriendID%> to confirm your request

<%} %>

<%else if (Model.Type == Ditto.Models.FriendStatus.StatusType.Requested)
   { %>

Would you like to confirm <%:Model.FriendID %> as your friend? <%: Html.ActionLink("Yes", "ConfirmFriendship", new { confirmedUser = Model.FriendID })%> | <%: Html.ActionLink("No", "RemoveFriendship", new { removedUser = Model.FriendID })%>

<%} %>

<%else { %>

<%: Html.ActionLink("Remove", "RemoveFriendship", new { removedUser = Model.FriendID})%> <%:Model.FriendID%> as a friend

<%} %>
</div>

<script type="text/javascript">
    $("#requeststatus a").click(function () {
        $.get($(this).attr("href"), function (response) {
            $("#requeststatus").replaceWith(response);
        });
        return false;
    });
</script>